#include"udp_server.hpp"
#include"Route.hpp"
#include<functional>
#include<memory>

int main(int argc,char* argv[])
{
    if(argc!=2)
    {
        std::cerr << "Usage: " << argv[0] << " local-port" << std::endl;
        exit(-1);
    }
    uint16_t port=std::stoi(argv[1]);

    Route r;
    service_t message_route=std::bind(&Route::Forward,&r,std::placeholders::_1,std::placeholders::_2,std::placeholders::_3);
    
    std::unique_ptr<UDPServer> usvr=std::make_unique<UDPServer>(message_route,port);
    usvr->Init();
    usvr->Start();
}